package com.gulimall.product.app;


import com.gulimall.common.core.domain.Result;
import com.gulimall.common.dto.cart.CartItemDTO;
import com.gulimall.product.service.ISkuInfoService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * <p>
 * sku信息 前端控制器
 * </p>
 *
 * @author 坤哥
 * @since 2025-08-25
 */
@Slf4j
@RestController
@RequestMapping("/product/sku-info")
public class SkuInfoController {
    @Resource
    private ISkuInfoService skuInfoService;

    /**
     * 获取商品sku信息
     */
    @GetMapping("/getSkuInfo/{skuId}")
    public Result<CartItemDTO> getSkuInfo(@PathVariable("skuId") Long skuId){
        log.info("获取商品skuId为{}",skuId);
        CartItemDTO cartItemDTO = skuInfoService.getSkuInfo(skuId);
        return Result.ok(cartItemDTO);
    }
}
